<template>
<div class="news">
  <ul>
    <!-- 第一种写法 -->
    <!-- <li v-for="news in newsList" :key="news.id"><RouterLink :to="`/news/detail?id=${news.id}&title=${news.title}&content=${news.content}`">{{ news.content }}</RouterLink></li> -->
    <!-- 第二种写法 -->
    <li v-for="news in newsList" :key="news.id">
      <RouterLink 
      :to="{
        // path:'/news/detail',
        name:'xiangqing',
        query:{
          id:news.id,
          title:news.title,
          content:news.content
        }
      }">
      {{ news.content }}
      </RouterLink></li>
  </ul>
  <!-- 展示区 -->
   <div class="news_content">
    <RouterView></RouterView>
   </div>
</div>
</template>

<script lang="ts" setup name="News">
  import { reactive } from 'vue';
  import { RouterView,RouterLink } from 'vue-router';
  const newsList = reactive([
    {id:'001',title:'很好的城市',content:'大连'},
    {id:'002',title:'一夜暴富',content:'IT'},
    {id:'003',title:'内与大褂',content:'离婚'},
    {id:'004',title:'很好消息',content:'上岸大厂'},
  ])
</script>

<style scoped>
.news{
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  height: 100%;
}
.news ul{
  margin-top: 30px;
  /* list-style: none; */
  padding-left: 10px;
}
.news li::marker{
  color: blue;
}
.news li>a{
  font-size: 20px;
  line-height: 40px;
  text-decoration: none;
  color: skyblue;
  text-shadow: 0 0 1px blue;
}

</style>